package com.ruoyi.project.record.controller;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.record.domain.ScoreRecord;
import com.ruoyi.project.record.service.IScoreRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 积分记录Controller
 * 
 * @author wyh
 * @date 2024-08-14
 */
@RestController
@RequestMapping("/score/score/api")
public class ScoreRecordApiController extends BaseController
{
    @Autowired
    private IScoreRecordService scoreRecordService;

    /**
     * 查询积分记录列表
     */
    @PreAuthorize("@ss.hasPermi('score:score:list')")
    @GetMapping("/list")
    public TableDataInfo list(ScoreRecord scoreRecord)
    {
        Long userId = SecurityUtils.getUserId();
        scoreRecord.setUserId(userId);
        startPage();
        List<ScoreRecord> list = scoreRecordService.selectScoreRecordList(scoreRecord);
        return getDataTable(list);
    }
}
